/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sbbs.springboot.sample2;

import org.sbbs.springboot.sample2.demo.Demo;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 *
 * @author MACHENIKE
 */
@Controller
public class HelloController {

    @RequestMapping("/")
    public String hello() {
        return "Hello world!";
    }

    @RequestMapping(value="/getDemo1",produces = MediaType.APPLICATION_JSON_VALUE)
    @ResponseBody
    public Demo getDemo() {
        Demo demo = new Demo();
        demo.setId(1);
        demo.setName("Hero啊此");
        return demo;
    }
}
